/**
 * Hackystat Version 8 Framework
 * Twitter Widget RPC Interface
 */
package org.hackystat.ui.projectviewer.client.common;

import java.util.ArrayList;

import com.google.gwt.user.client.rpc.RemoteService;

/**
 * Remote procedure call interface for communicating with the Sensorbase and 
 * DailyProjectData services. 
 * 
 * @author David J. Nickles
 */
public interface RPCRemoteService extends RemoteService {
  
  /**
   * This method retrieves the host uris for the Sensorbase and DailyProjectData services from the
   * Project Viewer properties file.
   * 
   * @return An arraylist of the host uris for the Sensorbase and DailyProjectData services from the
   * Project Viewer properties file.
   * 
   * @gwt.typeArgs <java.lang.String>
   */
  public ArrayList getHosts(); 

  /**
   * Returns true if the passed host is a DailyProjectData Analysis service host.
   * 
   * @param host the URI for the DailyProjectData host.
   * @return Boolean indicating if the host is a valid DailyProjectData Analysis service.
   */
  public Boolean isDailyProjectDataHost(String host);

  /**
   * Returns true if the passed host is a SensorBase service host.
   * 
   * @param host the URI for the SensorBase.
   * @return Boolean indicating if the host is a valid SensorBase service.
   */
  public Boolean isSensorBaseHost(String host);

  /**
   * Returns true if the user and password is registered as a user with this host.
   * 
   * @param host the URI for the SensorBase
   * @param user user to authentication
   * @param password key for authentication
   * @return Boolean indicating if the user and password are valid in the sensorbase
   */
  public Boolean isRegistered(String host, String user, String password);

  /**
   * Registers the user with this host.
   * 
   * @param host the URI for the SensorBase
   * @param user user to authentication
   * @return Boolean indicating if the user and password are valid in the sensorbase
   */
  public Boolean registerUser(String host, String user);
  
  /**
   * Returns the attributes set in the Manifest file.
   * 
   * @return a list of strings of attribute values from the Manifest file.
   *
   * @gwt.typeArgs <java.lang.String>
   */
  public ArrayList getManifest(); 
  
  /**
   * Return a formatted description of the requested sensor data on the specified interval.
   * @param uri the URI for the SensorBase
   * @param project the project of interest
   * @param user user to authentication
   * @param password user password for authentication
   * @param year of interval
   * @param month of interval
   * @return Boolean array of days with data
   * @throws RPCException if problems occur during the Sensorbase procedure call
   * 
   * @gwt.typeArgs <java.lang.Boolean>
   */
  public ArrayList getOverview(String uri, String project, String user, String password, 
    int year, int month) throws RPCException;  

  /**
   * Create a project.
   * 
   * @param host the URI for the SensorBase.
   * @param user user to authentication.
   * @param password user password for authentication.
   * @param parcel the project data.
   * @return String whether the deletion suceeded.
   */
  public String putProject(String host, String user, String password, ProjectParcel parcel);

  /**
   * Returns the index of all Projects from this server for this user..
   * @param uri the URI for the SensorBase.
   * @param user username (email address) for authentication.
   * @param password user password for authentication.
   * @return Returns the index of all Projects from this server for this user.
   * @throws RPCException if problems occur during the Sensorbase procedure call.
   * 
   * @gwt.typeArgs <org.hackystat.ui.projectviewer.client.common.ProjectParcel>
   */
  public ArrayList getProjectParcels(String uri, String user, String password)
    throws RPCException;
      
  /**
   * Deletes project data.
   * 
   * @param host the URI for the SensorBase.
   * @param user user to authentication.
   * @param password user password for authentication.
   * @param project the project name.
   * @return String indicating whether the deletion succeeded.
   */
  public String deleteProject(String host, String user, String password, String project);

  /**
   * Invites the user to the project.
   * @param host the URI for the SensorBase.
   * @param inviter username (email address) for authentication.
   * @param password user password for authentication.
   * @param invitee username (email address) destination for invitation.
   * @param projectName the project name.
   * @return Returns the index of all Projects from this server for this user.
   * @throws RPCException if problems occur during the Sensorbase procedure call.
   * 
   * @gwt.typeArgs <java.lang.String>
   */
  public ArrayList invite(String host, String inviter, String password, String invitee, 
    String projectName) throws RPCException;

  /**
   * This method responds to an invitation to join a project.
   * @param host the URI for the SensorBase.
   * @param email username (Invitee).
   * @param password user password for authentication.
   * @param projectName the project name.
   * @param owner of project (Inviter).
   * @param reply true to accept, false to decline.
   * @return Returns the index of all Projects from this server for this user.
   * @throws RPCException if problems occur during the Sensorbase procedure call.
   */
  public String rsvp(String host, String email, String password,
    String projectName, String owner, Boolean reply ) throws RPCException;
    
  /**
   * Logs the message from the javascript client.
   * 
   * @param text message to log.
   */
  public void logClient(String text);
}
